package org.example.campus_sys_backend.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.example.campus_sys_backend.model.ClassInfo;

import java.util.Date;

@Mapper
public interface ClassInfoMapper {
    @Insert("insert into class (name,created_Time,class_desc,activity_id) " +
            "values (#{name}, #{createdTime}, #{classDesc},  #{activityId})")
    Integer insertClass (ClassInfo classInfo);
    @Insert("insert into class_teacher(class_id,teacher_name) values (#{classId}, #{teacherName})")
    Integer configureTeacher (@Param("classId") Integer classId,@Param("teacherName") String teacherName);

    @Update("update class set name = #{name}, created_time = #{createdTime}, " +
            "class_desc = #{classDesc}, activity_id = #{activityId} where id = #{id}")
    Integer updateClass (@Param("id") Integer id, @Param("name") String name,@Param("createdTime") Date createdTime,
                         @Param("classDesc") String classDesc, @Param("activityId") Integer activityId);
}
